package com.java.base.exercise.guava;

import com.google.common.base.Charsets;
import com.google.common.io.CharSink;
import com.google.common.io.CharSource;
import com.google.common.io.Files;
import org.junit.Test;

import java.io.File;
import java.io.IOException;

/**
 * @Author RenPu
 * @Date 2021/7/3 14:27
 * @Version 1.0
 * @Description: 使用guava提供的类，来实现IO文件的copy
 **/
public class IOTest {


    @Test
    public void copyFile() throws IOException {

        CharSource charSource = Files.asCharSource(new File("test.txt"), Charsets.UTF_8);

        CharSink charSink = Files.asCharSink(new File("testOne.txt"), Charsets.UTF_8);
        charSource.copyTo(charSink);


    }


}
